<script>
// mouted执行顺序extends>mixins>本身
// methods中本身覆盖mixins覆盖extends
import BaseConsumeItem from './BaseConsumeItem'
import ConsumeMixinItem from './ConsumeMixinItem'
import { open } from '@/utils/JumpUtils.js'
export default {
  extends: BaseConsumeItem,
  mixins: [ConsumeMixinItem],
  components: {

  },
  data() {
    return {
      iconUrl: require('../../assets/bus_card.png')
    }
  },
  // watch: {
  //   state(newValue, oldValue) {
  //     switch (newValue) {
  //       case 0: // 待支付
  //         // this.iconStyle = 'baseBgColorNoActive'
  //         // this.descStyle = 'baseColorNoAcitve'
  //         this.desc = '待支付'
  //         break
  //       case 1: // 成功：消费-渠道成功；充值-渠道成功，充值成功
  //         // this.iconStyle = 'baseBgColorNoActive'
  //         if (this.data.TRADE_SCENE === 4) {
  //           this.desc = '+ ' + this.price
  //         } else {
  //           this.desc = '- ' + this.price
  //         }
  //         break
  //       case 2: // 失败：渠道失败
  //         // this.iconStyle = 'consume-fail-icon'
  //         // this.descStyle = 'consume-color-999'
  //         this.desc = '支付失败'
  //         break
  //       case 3: // 处理中：渠道处理中
  //         // this.iconStyle = 'consume-fail-icon'
  //         // this.descStyle = 'consume-color-999'
  //         this.desc = '支付中'
  //         break
  //       case 4: // 渠道成功，充值处理中
  //         // this.iconStyle = 'consume-fail-icon'
  //         // this.descStyle = 'consume-color-999'
  //         this.desc = '支付中'
  //         break
  //       case 5: // 渠道成功，充值失败
  //         // this.iconStyle = 'consume-fail-icon'
  //         // this.descStyle = 'consume-color-999'
  //         this.desc = '支付失败'
  //         break
  //       case 9: // 取消
  //         // this.iconStyle = 'consume-fail-icon'
  //         // this.descStyle = 'consume-color-999'
  //         this.desc = '支付失败'
  //         break
  //     }
  //   }
  // },
  mounted() {
  },
  methods: {
    goToDetail() {
      let showTitle = this.tradeType !== 3
      open('routebill.html?_tv=' + showTitle + '&tradeno=' + this.tradeNo + '&tradetype=' + this.tradeType)
    },
    setStateDesc() {
      switch (this.state) {
        case 0: // 待支付
          this.desc = '待支付'
          break
        case 1: // 成功：消费-渠道成功；充值-渠道成功，充值成功
          if (this.tradeType === 4) {
            this.desc = '+ ' + this.price
          } else {
            this.desc = '- ' + this.price
          }
          break
        case 2: // 失败：渠道失败
          this.desc = '支付失败'
          break
        case 3: // 处理中：渠道处理中
          this.desc = '支付中'
          break
        case 4: // 渠道成功，充值处理中
          this.desc = '支付中'
          break
        case 5: // 渠道成功，充值失败
          this.desc = '支付失败'
          break
        case 9: // 取消
          this.desc = '支付失败'
          break
      }
      // 退款状态展示
      let refundStatus = this.data.TRADE_BACK_STATUS
      switch (refundStatus) {
        case 1: // 未退款
          break
        case 2:
          this.refundState = '部分退款'
          break
        case 3:
          this.refundState = '已退款'
          break
        default:
          break
      }
    }
  }
}
</script>
